#pragma once
/*!
 * \file 
 * IIntrBackup2.h
 */

#include "../_inc/def_interface.h"
/*!
 * \brief Interface class for backup AVI files
 *
 * This is an interface class for backup AVI files
 *
 * - header file: IIntrBackup2.h
 * - lib: backup.lib
 * - DLL: backup.dll
 */
class AFX_EXT_CLASS IIntrBackup2
{
public:
	/*!
	 * Creates backup manager object
	 *
	 * @return backup manager object. If NULL, failed to get the object.
	 */
	static IIntrBackup2 *Create(int nParam);
	virtual ~IIntrBackup2(void);	//!< Destructor

public:
	/*!
	 * Sets callback function
	 *
	 * @param pCallbackProc Specifies the address of the PCALLBACK_APP callback function.
	 * @param pCallbackParam Pointer to the context that will be supplied when callback function is called.
	 *
	 * @remark
	 * This object delivers services.
	 * The services are define at enum _Bak
	 * and services are the followings:
	 *
	 *	FINISH_BAK : send a notice to the application that backup is finished.
	 *	
	 *	BACKUP_GET_TIME_INDEX : Gets index information from the time list.
	 *	BACKUP_GET_TIME_NEXT : Gets an index number from the time list.
	 *	BACKUP_GET_TIME_NEXT_CHECKED : Gets an index number, which are checked, from the time list
	 *	
	 *	BACKUP_GET_EVENT_INDEX : Gets index information from the event list.
	 *	BACKUP_GET_EVENT_NEXT : Gets an index number from the event list.
	 *	BACKUP_GET_EVENT_NEXT_CHECKED : Gets an index number, which are checked, from the event list
	 *
	 * @see _Bak
	 */
	virtual void SetCallback(PCALLBACK_APP pCallbackProc, VOID *pCallbackParam);
	/*!
	 * Sets AVS file name parsing format
	 * It does not have much information about file name
	 * It checks that first channel starts 0 or 1.
	 *
	 * @param stFmt contains the information about the channel start number
	 */
	virtual void SetAVIFileNameFormat(ST_FILE_NAME_FORMAT stFmt);

	/*!
	 * Initialize backup information.
	 *
	 * @param tzBackupPath The folder where the backup file is going to save.
	 * @param nStartIndex The number of index that backup starts from.
	 * @param tStartTime The time of index that backup starts from.
	 * @param nEndIndex The number of index that backup ends to.
	 * @param tEndTime The time of index that backup ends to.
	 * @param nBackupMode 3 types of backup mode supported.
	 * The mode is followings:
	 *
	 *	bm_List1 : Makes 1 AVI file from current list.
	 *	bm_ListSelected : Makes several files depending on the list.
	 *	bm_Time : Make 1 AVI file from start to end referenced by the given time.
	 *
	 * @param nSearchType
	 *
	 *	search_time : search from the time list
	 *	search_event : search from the event list
	 *
	 * @param nRecMode type of record files
	 *
	 *	RECMODE_AV2 : Recording files are AV2 format
	 *	RECMODE_AVI : Recording files are AVI format
	 *
	 * @see _TAG_BACKUP_MODE, SEARCH_TYPE, _tagRECMODE
	 */
	virtual void InitBackup(TCHAR *tzBackupPath, 
							int nStartIndex, time_t tStartTime,
							int nEndIndex, time_t tEndTime,
							int nBackupMode,
							SEARCH_TYPE nSearchType,
							int nRecMode) {};
	/*!
	 * Sets a camera number that will backup
	 *
	 * @param nCam the number of camera.
	 */
	virtual void SetSelCamera(int nCam) {};
	/*!
	 * Starts backup
	 */
	virtual BOOL StartBackup() { return FALSE; };
	/*!
	 * Stop backup
	 */
	virtual void StopBackup() {};
	/*!
	 * Sets audio format
	 * When you use AV2 file format, user should define audio format.
	 *
	 * @param nAudioFormat Waveform format Linear PCM = 1, MULAW PCM = 7
	 * @param nAudioFrequecy Waveform frequency in Hz
	 * @param nAudioBitPerSample Waveform bits per samples of which values are 8 or 16 only.
	 */
	virtual void SetAudioFormat(int nAudioFormat, int nAudioFrequecy, int nAudioBitPerSample) {};

protected:
	IIntrBackup2();

	CALLBACK_APP	m_pCallbackProc;
	VOID			*m_pCallbackParam;

	ST_FILE_NAME_FORMAT m_stAVIFileNameFormat;

};
